package com.quick.admin.service;

import com.quick.admin.dao.AdminUserDao;
import com.quick.common.dto.SearchUserDto;
import com.quick.common.dto.UserInfoDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 胡通达
 * @version 1.0
 * @date 2021-01-27 15:58
 */
@Service
public class AdminUserService {

    @Autowired
    private AdminUserDao adminUserDao;

    /**
     * 获取普通用户信息
     * @param searchUserDto
     * @return
     */
    public Map<String, Object> searchGeneralUserList(SearchUserDto searchUserDto) {
        List<UserInfoDto> list = adminUserDao.searchGeneralUserList(searchUserDto);
        int total = adminUserDao.searchGeneralUserTotal(searchUserDto);
        HashMap<String, Object> map = new HashMap<>(16);
        map.put("total",total);
        map.put("items",list);
        return map;
    }

    /**
     * 获取会员用户信息
     * @param searchUserDto
     * @return
     */
    public Map<String, Object> searchMemberUserList(SearchUserDto searchUserDto) {
        List<UserInfoDto> list = adminUserDao.searchMemberUserList(searchUserDto);
        int total = adminUserDao.searchMemberUserTotal(searchUserDto);
        HashMap<String, Object> map = new HashMap<>(16);
        map.put("total",total);
        map.put("items",list);
        return map;
    }

    /**
     * 获取过期会员信息
     * @param searchUserDto
     * @return
     */
    public Map<String, Object> searchNotMemberUserList(SearchUserDto searchUserDto) {
        List<UserInfoDto> list = adminUserDao.searchNotMemberUserList(searchUserDto);
        int total = adminUserDao.searchNotMemberUserTotal(searchUserDto);
        HashMap<String, Object> map = new HashMap<>(16);
        map.put("total",total);
        map.put("items",list);
        return map;
    }
}
